﻿using System;
using System.ComponentModel;
using System.IO;
using System.Runtime.Serialization;

namespace HalconDotNet
{
	/// <summary>Represents an instance of a support vector machine.</summary>
	// Token: 0x02000025 RID: 37
	[Serializable]
	public class HClassSvm : HHandle, ISerializable, ICloneable
	{
		// Token: 0x0600030C RID: 780 RVA: 0x0000883B File Offset: 0x00006A3B
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HClassSvm() : base(HHandleBase.UNDEF)
		{
		}

		// Token: 0x0600030D RID: 781 RVA: 0x0001260C File Offset: 0x0001080C
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HClassSvm(IntPtr handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x0600030E RID: 782 RVA: 0x0001261B File Offset: 0x0001081B
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HClassSvm(HHandle handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x0600030F RID: 783 RVA: 0x0001262A File Offset: 0x0001082A
		private void AssertSemType()
		{
			base.AssertSemType("class_svm");
		}

		// Token: 0x06000310 RID: 784 RVA: 0x00012637 File Offset: 0x00010837
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HClassSvm obj)
		{
			obj = new HClassSvm(HHandleBase.UNDEF);
			return obj.Load(proc, parIndex, err);
		}

		// Token: 0x06000311 RID: 785 RVA: 0x00012650 File Offset: 0x00010850
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HClassSvm[] obj)
		{
			HTuple htuple;
			err = HTuple.LoadNew(proc, parIndex, err, out htuple);
			obj = new HClassSvm[htuple.Length];
			for (int i = 0; i < htuple.Length; i++)
			{
				obj[i] = new HClassSvm(HalconAPI.IsLegacyHandleMode() ? htuple[i].IP : htuple[i].H);
			}
			htuple.Dispose();
			return err;
		}

		/// <summary>
		///   Read a support vector machine from a file.
		///   Modified instance represents: SVM handle.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x06000312 RID: 786 RVA: 0x000126C0 File Offset: 0x000108C0
		public HClassSvm(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(1846);
			HalconAPI.StoreS(proc, 0, fileName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Create a support vector machine for pattern classification.
		///   Modified instance represents: SVM handle.
		/// </summary>
		/// <param name="numFeatures">Number of input variables (features) of the SVM. Default: 10</param>
		/// <param name="kernelType">The kernel type. Default: "rbf"</param>
		/// <param name="kernelParam">Additional parameter for the kernel function. In case of RBF kernel the value for gamma@f$  Default: 0.02</param>
		/// <param name="nu">Regularisation constant of the SVM. Default: 0.05</param>
		/// <param name="numClasses">Number of classes. Default: 5</param>
		/// <param name="mode">The mode of the SVM. Default: "one-versus-one"</param>
		/// <param name="preprocessing">Type of preprocessing used to transform the feature vectors. Default: "normalization"</param>
		/// <param name="numComponents">Preprocessing parameter: Number of transformed features (ignored for Preprocessing $=$ 'none' and Preprocessing $=$ 'normalization'). Default: 10</param>
		// Token: 0x06000313 RID: 787 RVA: 0x0001270C File Offset: 0x0001090C
		public HClassSvm(int numFeatures, string kernelType, double kernelParam, double nu, int numClasses, string mode, string preprocessing, int numComponents)
		{
			IntPtr proc = HalconAPI.PreCall(1861);
			HalconAPI.StoreI(proc, 0, numFeatures);
			HalconAPI.StoreS(proc, 1, kernelType);
			HalconAPI.StoreD(proc, 2, kernelParam);
			HalconAPI.StoreD(proc, 3, nu);
			HalconAPI.StoreI(proc, 4, numClasses);
			HalconAPI.StoreS(proc, 5, mode);
			HalconAPI.StoreS(proc, 6, preprocessing);
			HalconAPI.StoreI(proc, 7, numComponents);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		// Token: 0x06000314 RID: 788 RVA: 0x00012798 File Offset: 0x00010998
		void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
		{
			HSerializedItem hserializedItem = this.SerializeClassSvm();
			byte[] value = hserializedItem;
			hserializedItem.Dispose();
			info.AddValue("data", value, typeof(byte[]));
		}

		// Token: 0x06000315 RID: 789 RVA: 0x000127D0 File Offset: 0x000109D0
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HClassSvm(SerializationInfo info, StreamingContext context)
		{
			HSerializedItem hserializedItem = new HSerializedItem((byte[])info.GetValue("data", typeof(byte[])));
			this.DeserializeClassSvm(hserializedItem);
			hserializedItem.Dispose();
		}

		/// <summary>Serialize object to binary stream in HALCON format</summary>
		// Token: 0x06000316 RID: 790 RVA: 0x00012810 File Offset: 0x00010A10
		public new void Serialize(Stream stream)
		{
			HSerializedItem hserializedItem = this.SerializeClassSvm();
			hserializedItem.Serialize(stream);
			hserializedItem.Dispose();
		}

		/// <summary>Deserialize object from binary stream in HALCON format</summary>
		// Token: 0x06000317 RID: 791 RVA: 0x00012824 File Offset: 0x00010A24
		public new static HClassSvm Deserialize(Stream stream)
		{
			HClassSvm hclassSvm = new HClassSvm();
			HSerializedItem hserializedItem = HSerializedItem.Deserialize(stream);
			hclassSvm.DeserializeClassSvm(hserializedItem);
			hserializedItem.Dispose();
			return hclassSvm;
		}

		// Token: 0x06000318 RID: 792 RVA: 0x0001284A File Offset: 0x00010A4A
		object ICloneable.Clone()
		{
			return this.Clone();
		}

		// Token: 0x06000319 RID: 793 RVA: 0x00012854 File Offset: 0x00010A54
		public new HClassSvm Clone()
		{
			HSerializedItem hserializedItem = this.SerializeClassSvm();
			HClassSvm hclassSvm = new HClassSvm();
			hclassSvm.DeserializeClassSvm(hserializedItem);
			hserializedItem.Dispose();
			return hclassSvm;
		}

		/// <summary>
		///   Classify an image with a support vector machine.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="image">Input image.</param>
		/// <returns>Segmented classes.</returns>
		// Token: 0x0600031A RID: 794 RVA: 0x0001287C File Offset: 0x00010A7C
		public HRegion ClassifyImageClassSvm(HImage image)
		{
			IntPtr proc = HalconAPI.PreCall(433);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HRegion result;
			num = HRegion.LoadNew(proc, 1, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
			return result;
		}

		/// <summary>
		///   Add training samples from an image to the training data of a support vector machine.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="image">Training image.</param>
		/// <param name="classRegions">Regions of the classes to be trained.</param>
		// Token: 0x0600031B RID: 795 RVA: 0x000128D4 File Offset: 0x00010AD4
		public void AddSamplesImageClassSvm(HImage image, HRegion classRegions)
		{
			IntPtr proc = HalconAPI.PreCall(434);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.Store(proc, 2, classRegions);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
			GC.KeepAlive(classRegions);
		}

		/// <summary>
		///   Get the training data of a support vector machine (SVM).
		///   Instance represents: Handle of a SVM that contains training data.
		/// </summary>
		/// <returns>Handle of the training data of the classifier.</returns>
		// Token: 0x0600031C RID: 796 RVA: 0x00012924 File Offset: 0x00010B24
		public HClassTrainData GetClassTrainDataSvm()
		{
			IntPtr proc = HalconAPI.PreCall(1791);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HClassTrainData result;
			num = HClassTrainData.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Add training data to a support vector machine (SVM).
		///   Instance represents: Handle of a SVM which receives the training data.
		/// </summary>
		/// <param name="classTrainDataHandle">Training data for a classifier.</param>
		// Token: 0x0600031D RID: 797 RVA: 0x0001296C File Offset: 0x00010B6C
		public void AddClassTrainDataSvm(HClassTrainData classTrainDataHandle)
		{
			IntPtr proc = HalconAPI.PreCall(1792);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, classTrainDataHandle);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
			GC.KeepAlive(classTrainDataHandle);
		}

		/// <summary>
		///   Selects an optimal combination of features to classify the provided data.
		///   Modified instance represents: A trained SVM classifier using only the selected  features.
		/// </summary>
		/// <param name="classTrainDataHandle">Handle of the training data.</param>
		/// <param name="selectionMethod">Method to perform the selection. Default: "greedy"</param>
		/// <param name="genParamName">Names of generic parameters to configure the  selection process and the classifier. Default: []</param>
		/// <param name="genParamValue">Values of generic parameters to configure the  selection process and the classifier. Default: []</param>
		/// <param name="score">The achieved score using two-fold cross-validation.</param>
		/// <returns>The selected feature set, contains  indices.</returns>
		// Token: 0x0600031E RID: 798 RVA: 0x000129B0 File Offset: 0x00010BB0
		public HTuple SelectFeatureSetSvm(HClassTrainData classTrainDataHandle, string selectionMethod, HTuple genParamName, HTuple genParamValue, out HTuple score)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1800);
			HalconAPI.Store(proc, 0, classTrainDataHandle);
			HalconAPI.StoreS(proc, 1, selectionMethod);
			HalconAPI.Store(proc, 2, genParamName);
			HalconAPI.Store(proc, 3, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HTuple result;
			num = HTuple.LoadNew(proc, 1, num, out result);
			num = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, num, out score);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(classTrainDataHandle);
			return result;
		}

		/// <summary>
		///   Selects an optimal combination of features to classify the provided data.
		///   Modified instance represents: A trained SVM classifier using only the selected  features.
		/// </summary>
		/// <param name="classTrainDataHandle">Handle of the training data.</param>
		/// <param name="selectionMethod">Method to perform the selection. Default: "greedy"</param>
		/// <param name="genParamName">Names of generic parameters to configure the  selection process and the classifier. Default: []</param>
		/// <param name="genParamValue">Values of generic parameters to configure the  selection process and the classifier. Default: []</param>
		/// <param name="score">The achieved score using two-fold cross-validation.</param>
		/// <returns>The selected feature set, contains  indices.</returns>
		// Token: 0x0600031F RID: 799 RVA: 0x00012A50 File Offset: 0x00010C50
		public HTuple SelectFeatureSetSvm(HClassTrainData classTrainDataHandle, string selectionMethod, string genParamName, double genParamValue, out HTuple score)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1800);
			HalconAPI.Store(proc, 0, classTrainDataHandle);
			HalconAPI.StoreS(proc, 1, selectionMethod);
			HalconAPI.StoreS(proc, 2, genParamName);
			HalconAPI.StoreD(proc, 3, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HTuple result;
			num = HTuple.LoadNew(proc, 1, num, out result);
			num = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, num, out score);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(classTrainDataHandle);
			return result;
		}

		/// <summary>
		///   Create a look-up table using a Support-Vector-Machine to classify byte images.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		/// <returns>Handle of the LUT classifier.</returns>
		// Token: 0x06000320 RID: 800 RVA: 0x00012AE4 File Offset: 0x00010CE4
		public HClassLUT CreateClassLutSvm(HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(1821);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HClassLUT result;
			num = HClassLUT.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>Clear a support vector machine.</summary>
		/// <param name="SVMHandle">SVM handle.</param>
		// Token: 0x06000321 RID: 801 RVA: 0x00012B48 File Offset: 0x00010D48
		public static void ClearClassSvm(HClassSvm[] SVMHandle)
		{
			HTuple htuple = HHandleBase.ConcatArray(SVMHandle);
			IntPtr proc = HalconAPI.PreCall(1842);
			HalconAPI.Store(proc, 0, htuple);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(htuple);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(SVMHandle);
		}

		/// <summary>
		///   Clear a support vector machine.
		///   Instance represents: SVM handle.
		/// </summary>
		// Token: 0x06000322 RID: 802 RVA: 0x00012B8C File Offset: 0x00010D8C
		public void ClearClassSvm()
		{
			IntPtr proc = HalconAPI.PreCall(1842);
			base.Store(proc, 0);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>Clear the training data of a support vector machine.</summary>
		/// <param name="SVMHandle">SVM handle.</param>
		// Token: 0x06000323 RID: 803 RVA: 0x00012BC0 File Offset: 0x00010DC0
		public static void ClearSamplesClassSvm(HClassSvm[] SVMHandle)
		{
			HTuple htuple = HHandleBase.ConcatArray(SVMHandle);
			IntPtr proc = HalconAPI.PreCall(1843);
			HalconAPI.Store(proc, 0, htuple);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(htuple);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(SVMHandle);
		}

		/// <summary>
		///   Clear the training data of a support vector machine.
		///   Instance represents: SVM handle.
		/// </summary>
		// Token: 0x06000324 RID: 804 RVA: 0x00012C04 File Offset: 0x00010E04
		public void ClearSamplesClassSvm()
		{
			IntPtr proc = HalconAPI.PreCall(1843);
			base.Store(proc, 0);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Deserialize a serialized support vector machine (SVM).
		///   Modified instance represents: SVM handle.
		/// </summary>
		/// <param name="serializedItemHandle">Handle of the serialized item.</param>
		// Token: 0x06000325 RID: 805 RVA: 0x00012C38 File Offset: 0x00010E38
		public void DeserializeClassSvm(HSerializedItem serializedItemHandle)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1844);
			HalconAPI.Store(proc, 0, serializedItemHandle);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(serializedItemHandle);
		}

		/// <summary>
		///   Serialize a support vector machine (SVM).
		///   Instance represents: SVM handle.
		/// </summary>
		/// <returns>Handle of the serialized item.</returns>
		// Token: 0x06000326 RID: 806 RVA: 0x00012C8C File Offset: 0x00010E8C
		public HSerializedItem SerializeClassSvm()
		{
			IntPtr proc = HalconAPI.PreCall(1845);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HSerializedItem result;
			num = HSerializedItem.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Read a support vector machine from a file.
		///   Modified instance represents: SVM handle.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x06000327 RID: 807 RVA: 0x00012CD4 File Offset: 0x00010ED4
		public void ReadClassSvm(string fileName)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1846);
			HalconAPI.StoreS(proc, 0, fileName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Write a support vector machine to a file.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x06000328 RID: 808 RVA: 0x00012D20 File Offset: 0x00010F20
		public void WriteClassSvm(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(1847);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, fileName);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Read the training data of a support vector machine from a file.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x06000329 RID: 809 RVA: 0x00012D5C File Offset: 0x00010F5C
		public void ReadSamplesClassSvm(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(1848);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, fileName);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Write the training data of a support vector machine to a file.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x0600032A RID: 810 RVA: 0x00012D98 File Offset: 0x00010F98
		public void WriteSamplesClassSvm(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(1849);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, fileName);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Evaluate a feature vector by a support vector machine.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="features">Feature vector.</param>
		/// <returns>Result of evaluating the feature vector with the SVM.</returns>
		// Token: 0x0600032B RID: 811 RVA: 0x00012DD4 File Offset: 0x00010FD4
		public HTuple EvaluateClassSvm(HTuple features)
		{
			IntPtr proc = HalconAPI.PreCall(1850);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, features);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(features);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Classify a feature vector by a support vector machine.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="features">Feature vector.</param>
		/// <param name="num">Number of best classes to determine. Default: 1</param>
		/// <returns>Result of classifying the feature vector with the SVM.</returns>
		// Token: 0x0600032C RID: 812 RVA: 0x00012E2C File Offset: 0x0001102C
		public HTuple ClassifyClassSvm(HTuple features, HTuple num)
		{
			IntPtr proc = HalconAPI.PreCall(1851);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, features);
			HalconAPI.Store(proc, 2, num);
			HalconAPI.InitOCT(proc, 0);
			int num2 = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(features);
			HalconAPI.UnpinTuple(num);
			HTuple result;
			num2 = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, num2, out result);
			HalconAPI.PostCall(proc, num2);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Approximate a trained support vector machine by a reduced support vector machine for faster classification.
		///   Instance represents: Original SVM handle.
		/// </summary>
		/// <param name="method">Type of postprocessing to reduce number of SV. Default: "bottom_up"</param>
		/// <param name="minRemainingSV">Minimum number of remaining SVs. Default: 2</param>
		/// <param name="maxError">Maximum allowed error of reduction. Default: 0.001</param>
		/// <returns>SVMHandle of reduced SVM.</returns>
		// Token: 0x0600032D RID: 813 RVA: 0x00012E94 File Offset: 0x00011094
		public HClassSvm ReduceClassSvm(string method, int minRemainingSV, double maxError)
		{
			IntPtr proc = HalconAPI.PreCall(1852);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, method);
			HalconAPI.StoreI(proc, 2, minRemainingSV);
			HalconAPI.StoreD(proc, 3, maxError);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HClassSvm result;
			num = HClassSvm.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Train a support vector machine.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="epsilon">Stop parameter for training. Default: 0.001</param>
		/// <param name="trainMode">Mode of training. For normal operation: 'default'. If SVs already included in the SVM should be used for training: 'add_sv_to_train_set'. For alpha seeding: the respective SVM handle. Default: "default"</param>
		// Token: 0x0600032E RID: 814 RVA: 0x00012EF4 File Offset: 0x000110F4
		public void TrainClassSvm(double epsilon, HTuple trainMode)
		{
			IntPtr proc = HalconAPI.PreCall(1853);
			base.Store(proc, 0);
			HalconAPI.StoreD(proc, 1, epsilon);
			HalconAPI.Store(proc, 2, trainMode);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(trainMode);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Train a support vector machine.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="epsilon">Stop parameter for training. Default: 0.001</param>
		/// <param name="trainMode">Mode of training. For normal operation: 'default'. If SVs already included in the SVM should be used for training: 'add_sv_to_train_set'. For alpha seeding: the respective SVM handle. Default: "default"</param>
		// Token: 0x0600032F RID: 815 RVA: 0x00012F40 File Offset: 0x00011140
		public void TrainClassSvm(double epsilon, string trainMode)
		{
			IntPtr proc = HalconAPI.PreCall(1853);
			base.Store(proc, 0);
			HalconAPI.StoreD(proc, 1, epsilon);
			HalconAPI.StoreS(proc, 2, trainMode);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Compute the information content of the preprocessed feature vectors of a support vector machine
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="preprocessing">Type of preprocessing used to transform the feature vectors. Default: "principal_components"</param>
		/// <param name="cumInformationCont">Cumulative information content of the transformed feature vectors.</param>
		/// <returns>Relative information content of the transformed feature vectors.</returns>
		// Token: 0x06000330 RID: 816 RVA: 0x00012F84 File Offset: 0x00011184
		public HTuple GetPrepInfoClassSvm(string preprocessing, out HTuple cumInformationCont)
		{
			IntPtr proc = HalconAPI.PreCall(1854);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, preprocessing);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, num, out result);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out cumInformationCont);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Return the number of support vectors of a support vector machine.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="numSVPerSVM">Number of SV of each sub-SVM.</param>
		/// <returns>Total number of support vectors.</returns>
		// Token: 0x06000331 RID: 817 RVA: 0x00012FE8 File Offset: 0x000111E8
		public int GetSupportVectorNumClassSvm(out HTuple numSVPerSVM)
		{
			IntPtr proc = HalconAPI.PreCall(1855);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			int result;
			num = HalconAPI.LoadI(proc, 0, num, out result);
			num = HTuple.LoadNew(proc, 1, HTupleType.INTEGER, num, out numSVPerSVM);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Return the index of a support vector from a trained support vector machine.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="indexSupportVector">Index of the stored support vector.</param>
		/// <returns>Index of the support vector in the training set.</returns>
		// Token: 0x06000332 RID: 818 RVA: 0x00013044 File Offset: 0x00011244
		public double GetSupportVectorClassSvm(int indexSupportVector)
		{
			IntPtr proc = HalconAPI.PreCall(1856);
			base.Store(proc, 0);
			HalconAPI.StoreI(proc, 1, indexSupportVector);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			double result;
			num = HalconAPI.LoadD(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Return the number of training samples stored in the training data of a support vector machine.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <returns>Number of stored training samples.</returns>
		// Token: 0x06000333 RID: 819 RVA: 0x00013094 File Offset: 0x00011294
		public int GetSampleNumClassSvm()
		{
			IntPtr proc = HalconAPI.PreCall(1857);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			int result;
			num = HalconAPI.LoadI(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Return a training sample from the training data of a support vector machine.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="indexSample">Number of the stored training sample.</param>
		/// <param name="target">Target vector of the training sample.</param>
		/// <returns>Feature vector of the training sample.</returns>
		// Token: 0x06000334 RID: 820 RVA: 0x000130DC File Offset: 0x000112DC
		public HTuple GetSampleClassSvm(int indexSample, out int target)
		{
			IntPtr proc = HalconAPI.PreCall(1858);
			base.Store(proc, 0);
			HalconAPI.StoreI(proc, 1, indexSample);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, num, out result);
			num = HalconAPI.LoadI(proc, 1, num, out target);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Add a training sample to the training data of a support vector machine.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="features">Feature vector of the training sample to be stored.</param>
		/// <param name="classVal">Class of the training sample to be stored.</param>
		// Token: 0x06000335 RID: 821 RVA: 0x00013140 File Offset: 0x00011340
		public void AddSampleClassSvm(HTuple features, HTuple classVal)
		{
			IntPtr proc = HalconAPI.PreCall(1859);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, features);
			HalconAPI.Store(proc, 2, classVal);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(features);
			HalconAPI.UnpinTuple(classVal);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Add a training sample to the training data of a support vector machine.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="features">Feature vector of the training sample to be stored.</param>
		/// <param name="classVal">Class of the training sample to be stored.</param>
		// Token: 0x06000336 RID: 822 RVA: 0x00013190 File Offset: 0x00011390
		public void AddSampleClassSvm(HTuple features, int classVal)
		{
			IntPtr proc = HalconAPI.PreCall(1859);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, features);
			HalconAPI.StoreI(proc, 2, classVal);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(features);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Return the parameters of a support vector machine.
		///   Instance represents: SVM handle.
		/// </summary>
		/// <param name="kernelType">The kernel type.</param>
		/// <param name="kernelParam">Additional parameter for the kernel.</param>
		/// <param name="nu">Regularization constant of the SVM.</param>
		/// <param name="numClasses">Number of classes of the test data.</param>
		/// <param name="mode">The mode of the SVM.</param>
		/// <param name="preprocessing">Type of preprocessing used to transform the feature vectors.</param>
		/// <param name="numComponents">Preprocessing parameter: Number of transformed features (ignored for Preprocessing $=$ 'none' and Preprocessing $=$ 'normalization').</param>
		/// <returns>Number of input variables (features) of the SVM.</returns>
		// Token: 0x06000337 RID: 823 RVA: 0x000131DC File Offset: 0x000113DC
		public int GetParamsClassSvm(out string kernelType, out double kernelParam, out double nu, out int numClasses, out string mode, out string preprocessing, out int numComponents)
		{
			IntPtr proc = HalconAPI.PreCall(1860);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			HalconAPI.InitOCT(proc, 4);
			HalconAPI.InitOCT(proc, 5);
			HalconAPI.InitOCT(proc, 6);
			HalconAPI.InitOCT(proc, 7);
			int num = HalconAPI.CallProcedure(proc);
			int result;
			num = HalconAPI.LoadI(proc, 0, num, out result);
			num = HalconAPI.LoadS(proc, 1, num, out kernelType);
			num = HalconAPI.LoadD(proc, 2, num, out kernelParam);
			num = HalconAPI.LoadD(proc, 3, num, out nu);
			num = HalconAPI.LoadI(proc, 4, num, out numClasses);
			num = HalconAPI.LoadS(proc, 5, num, out mode);
			num = HalconAPI.LoadS(proc, 6, num, out preprocessing);
			num = HalconAPI.LoadI(proc, 7, num, out numComponents);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Create a support vector machine for pattern classification.
		///   Modified instance represents: SVM handle.
		/// </summary>
		/// <param name="numFeatures">Number of input variables (features) of the SVM. Default: 10</param>
		/// <param name="kernelType">The kernel type. Default: "rbf"</param>
		/// <param name="kernelParam">Additional parameter for the kernel function. In case of RBF kernel the value for gamma@f$  Default: 0.02</param>
		/// <param name="nu">Regularisation constant of the SVM. Default: 0.05</param>
		/// <param name="numClasses">Number of classes. Default: 5</param>
		/// <param name="mode">The mode of the SVM. Default: "one-versus-one"</param>
		/// <param name="preprocessing">Type of preprocessing used to transform the feature vectors. Default: "normalization"</param>
		/// <param name="numComponents">Preprocessing parameter: Number of transformed features (ignored for Preprocessing $=$ 'none' and Preprocessing $=$ 'normalization'). Default: 10</param>
		// Token: 0x06000338 RID: 824 RVA: 0x000132A8 File Offset: 0x000114A8
		public void CreateClassSvm(int numFeatures, string kernelType, double kernelParam, double nu, int numClasses, string mode, string preprocessing, int numComponents)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1861);
			HalconAPI.StoreI(proc, 0, numFeatures);
			HalconAPI.StoreS(proc, 1, kernelType);
			HalconAPI.StoreD(proc, 2, kernelParam);
			HalconAPI.StoreD(proc, 3, nu);
			HalconAPI.StoreI(proc, 4, numClasses);
			HalconAPI.StoreS(proc, 5, mode);
			HalconAPI.StoreS(proc, 6, preprocessing);
			HalconAPI.StoreI(proc, 7, numComponents);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}
	}
}
